1
전통적인 코드에서 생성형 인공지능 애플리케이션으로
AI011Lesson 3
00:00

전통적인 코드에서 생성형 인공지능 애플리케이션으로

소프트웨어 개발의 환경은 근본적인 변화를 겪고 있습니다. 우리는 고정된 명령 중심 프로그래밍에서 유연하고 자연어 기반의 생성형 인공지능 상호작용으로 전환하고 있습니다.

1. 명령 체인의 파괴

무엇인지: 기존 애플리케이션은 고정된 그래픽 사용자 인터페이스(GUI) 또는 특정 언어에 의존하는 명령 세트에 의존합니다. 사용자가 예상되는 입력을 벗어나면 시스템은 실패합니다.

왜 중요한가: 생성형 인공지능 애플리케이션은 이전에는 없었던 유연성을 제공합니다. 사용자는 복잡한 목표를 달성하기 위해 자연어로 상호작용할 수 있으며, 문법보다는 의도에 맞춰 적응합니다.

2. 비결정론의 원칙

무엇인지: 기존 코드에서는 $1 + 1$ 항상 $2$와 같습니다. 이것은 결정론적입니다. 대규모 언어 모델(Large Language Models, LLMs)반대로, 확률에 기반하여 작동합니다.

어떻게 작동하는가: 같은 프롬프트에 대해 다른 결과를 생성할 수 있습니다. 이러한 다양성은 특별히 주목할 만한 특정 매개변수를 통해 관리됩니다, 온도입니다.

3. 기본 구성 요소: 토큰과 온도

  • 토큰: 모델이 사용하는 텍스트의 기본 수치적 '구성 요소'입니다. 단어는 이러한 하위 단어 단위로 분해됩니다.
  • 온도: 랜덤성을 제어하는 설정(0.0에서 1.0 사이). 낮은 값은 예측 가능하고 집중적인 텍스트를, 높은 값은 창의적이고 다양한 출력을 유도합니다.
보안 우선
애플리케이션 코드에 직접 API 키를 하드코딩하지 마세요. 항상 환경 변수(예: .env 파일 등)를 사용하여 AI 리소스를 무단 접근으로부터 보호하세요.
app.py
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
Question 1
Why are Large Language Models (LLMs) described as "non-deterministic"?
Because they can produce different results for the same prompt every time.
Because they always return the exact same output for a given input.
Because they cannot run on standard computer processors.
Because they require quantum computing to function.
Question 2
Which parameter should you decrease if you want the AI output to be more predictable and less creative?
Max Tokens
Top-P
Temperature
Frequency Penalty
Challenge: Building a "Study Buddy"
Apply your knowledge to a real-world scenario.
You are building a "Study Buddy" application that must provide strictly factual definitions for students preparing for exams. The application will connect to an Azure OpenAI resource.
Task 1
Identify the optimal Temperature setting for this specific task.
Solution:
Set Temperature to 0.0 or 0.1. This minimizes randomness and ensures the model provides the most likely, factual, and consistent definitions rather than creative or hallucinated responses.
Task 2
How should you secure the application's sensitive connection data?
Solution:
Move the API_KEY from the main code file into an environment variable or a hidden .env file. Use os.getenv("AZURE_OPENAI_KEY") to retrieve it securely at runtime.